/*
 * @lc app=leetcode.cn id=326 lang=javascript
 *
 * [326] 3的幂
 */

// @lc code=start
/**
 * @param {number} n
 * @return {boolean}
 */
var isPowerOfThree = function(n) {
    if(n<=0)return false
    if(n==1)return true
    while(n>1){
        n=n/3
        if(n!=parseInt(n))return false
    }
    return true
};
// @lc code=end
var isPowerOfThree = function(n) {
    let s=1
    while(s<n){
        s=s*3
    }
    if(s==n)return true
    else return false
};
